function ActiveMenu(boo)
{
    if(boo)
    {
    //Mo
        document.getElementById('aCup').style.display = "";
        document.getElementById('aMo').style.display = "none";
        document.getElementById(tblMainID).style.display = "";
        document.getElementById('tdLeft').style.width = "232px";
        document.getElementById('tdLeft').className = "";
        document.getElementById('tdMiddle').style.width = "8px";
        createCookie("statusMenu","true",1);
    }
    else
    {
    //Cup
        document.getElementById('aCup').style.display = "none";
        document.getElementById('aMo').style.display = "";
        document.getElementById(tblMainID).style.display = "none";
        document.getElementById('tdLeft').style.width = "0px";
        document.getElementById('tdLeft').className = "";
        document.getElementById('tdMiddle').style.width = "0px";
        createCookie("statusMenu","false",1);
    }        
}

function menu_logHref(href)
{
	if (href.indexOf('.chn') == -1) href += '.chn';
	createCookie('ChannelVN.menu', href, 1);
}
function menu_onload()
{
	var MenuStatus = readCookie("statusMenu");
	if(MenuStatus == "true")
	{
		ActiveMenu(true);
	}
	else
	{
		ActiveMenu(false);
	}
	
	// neu box khong co item thi an di
	var box, boxes = document.getElementsByTagName('li');
	for (var i=0; i<boxes.length; i++)
	{
		box = boxes[i];
		if (box.className == 'box')
		{
			if (box.getElementsByTagName('li').length == 0)
				box.style.display = 'none';
		}
	}
	
	
	if (window.location.href.indexOf('office.chn') == -1)
	{
		var href = readCookie('ChannelVN.menu');
		if (href && href != '')
		{
			var a, as, ul, uls = document.getElementsByTagName('ul');
			for (var i=0; i<uls.length; i++)
			{
				ul = uls[i];
				if (ul.className == 'menu')
				{
					as = ul.getElementsByTagName('a');
					if (overLoadMenuItem != '')
					{
						overLoadMenuItem += '.chn';
						for (var j=0; j<as.length; j++)
						{
							a = as[j];
							if (a.href.indexOf(overLoadMenuItem) > 0)
							{
								a.className = 'menuactive';
								return;
							}
						}
					}
					for (var j=0; j<as.length; j++)
					{
						a = as[j];
						if (a.href == window.location.href)
						{
							a.className = 'menuactive';
							return;
						}
					}
					for (var j=0; j<as.length; j++)
					{
						a = as[j];
						if (a.href.indexOf(href) > 0)
						{
							a.className = 'menuactive';
							return;
						}
					}
				}
			}
		}
	}
}
ie ? window.attachEvent('onload', menu_onload) : window.addEventListener('load', menu_onload, false);